package editor;

import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

/**
 * 
 * @author Massimiliano
 *
 */
public class KeyGrab extends KeyAdapter {
	
	private boolean keypressed;
	
	@Override
	public void keyPressed(KeyEvent e) {
		super.keyPressed(e);
		int keypress=e.getKeyCode();
		
		if (keypressed) return;
		
		keypressed=true;
		switch(keypress)
		{
			case KeyEvent.VK_1: System.out.println("ciao"); break;
			case KeyEvent.VK_2: break;
			case KeyEvent.VK_3: break;
			case KeyEvent.VK_4: break;
			case KeyEvent.VK_5: break;
			case KeyEvent.VK_6: break;
			case KeyEvent.VK_B: break;
			case KeyEvent.VK_E: break;
			case KeyEvent.VK_W: break;
			case KeyEvent.VK_LEFT: System.out.println("LEFT");break;
			case KeyEvent.VK_RIGHT: System.out.println("RIGHT");break;
			case KeyEvent.VK_UP: System.out.println("UP");break;
			case KeyEvent.VK_DOWN: System.out.println("DOWN");break;
		}
		
	}

	@Override
	public void keyReleased(KeyEvent e) {
		// TODO Auto-generated method stub
		super.keyReleased(e);
		keypressed=false;
	}
		
}
